package jp.ne.hatena.d.digitalsoul.warikan.mocks

import jp.ne.hatena.d.digitalsoul.warikan.models._
import jp.ne.hatena.d.digitalsoul.warikan.repositories.impl._

class MockSlopeRepositoryImpl extends SlopeRepositoryImpl {

	var slopes = Map[String, Slope]()
	
	override def nextId:String = (slopes.size + 1).toString
	
	override def add(slope:Slope) = slopes += (slope.id -> slope)
			
	override def forSlopeId(id:String):Option[Slope] = {
		if (slopes.contains(id)) Option(slopes(id)) else None 
	}
	
	override def forAll:List[Slope] = slopes.values.toList
	
	override def weightOf(slopeId:String, role:String):Int = slopes(slopeId).weights(role)
	
	def initialize = slopes = Map[String, Slope]()
	
}